<?
	session_start();
	include('conn.php');
	$id = $_REQUEST["cud"];	
	$sid = $_REQUEST["id"];
	
	if($id=="d") //delete entry
	{		
		$qry = "update society set status='9' where socid='$sid';";			
		$res = mysql_query($qry);
		echo $qry."---".$res;
	}
	else
	{		
		$name = $_REQUEST["name"];	
		$address = $_REQUEST["addr"];	
		$zipcode = $_REQUEST["zip"];	
		$road = $_REQUEST["road"];	
		$district = $_REQUEST["district"];	
		$locality = $_REQUEST["locality"];	
		
		if($id=="u")  //update entry
		{
			$qry = "update society set societyname='$name',address='$address', zipcode='$zipcode',
			road='$road', district='$district', locality='$locality', status='1' where socid='$sid';";			
			$res = mysql_query($qry);
			echo $qry."---".$res;
		}
		else if($id=="c") //create new entry
		{
			$qry = "insert into society(societyname,address,zipcode,status,road,district,locality) values ('$name','$address','$zipcode','1','$road','$district','$locality');";			
			$res = mysql_query($qry);
			echo $qry."---".$res;
		}
		else
			echo "ID not set";
	}
?>